var _PageSize=15;

$(function(){
    $('#btnSubmit').click(function () {_CurrentPage=1;ajaxGetList(true); });
    ajaxGetList(true);
})

function ajaxGetList(GetPageInfo) {
    _PageSize=$('#sltPage').val();
    $('#ajaxDataList').hide();
    $('#ajaxDataLoading').show();
    $.ajax({
        type: "GET",
        url: "../order",
        data: "AjaxType=PageInfo&pageSize="+_PageSize+'&currentPage='+_CurrentPage
            +"&time=" + new Date(),
        dataType:'JSON',
        success: function (result) {

            if(GetPageInfo)
            {
                pageInfoDisplay(result['pageInfo']);
            }

            var html="";
            if(result.pageData.length>0)
            {
                var items=result['pageData'];


                for(var i=0;i<items.length;i++)
                {
                    html+='<tr>';
                    html+='<td>'+items[i].created+'</td>';


                    html+='<td>'+items[i].title+'</td>';
                    html+='<td>'+items[i].create_username+'</td>';
                    html+='<td><a href=/newslist/?AjaxType=enditindex&id='+items[i]._id+'&name='+items[i].title+'>编辑</a>&nbsp;&nbsp;' ;
                    html+="<a href=#  onclick=\"return delnews(\'"+items[i]._id+"\',\'"+items[i].title+"\')\" >删除</a></td>";
                   // html+='<td><a href=/setting/RoleSet/?id='+$.parseJSON(items[i])._id+'&name='+escape($.parseJSON(items[i]).rolename)+'>设置权限</td>';

                    html+='</tr>';

                }
            }else
            {
                html="<tr><td colspan='7'>未找到任何数据</td></tr>";
            }
            $('#ajaxDataList').html(html);
            $('#ajaxDataList').show();
            $('#ajaxDataLoading').hide();
        }
    });
}

function showModal(uuid){
    $.fancybox({
        'autoScale': true,
        'showNavArrows': false,
        'transitionIn': 'none',
        'transitionOut': 'none',
        'scrolling':false,
        'hideOnOverlayClick':false,
        'type': 'iframe',
        'width':750,
        'height':550,
        'href': '../channel/auth/'+uuid

    });
}